package models

import (
	"gorm.io/gorm"
	"time"
)

type Message struct {
	ID         int64     `gorm:"primaryKey;autoIncrement;comment:消息id"`
	ToUserID   int64     `gorm:"not null;default:0;index:fk_user_message_to;comment:该消息接收者的id"`
	FromUserID int64     `gorm:"not null;default:0;index:fk_user_message_from;comment:该消息发送者的id"`
	Contents   string    `gorm:"type:varchar(255);not null;default:'';comment:消息内容"`
	CreateTime int64     `gorm:"not null;default:0;comment:自设创建时间(unix)"`
	CreatedAt  time.Time `gorm:"comment:创建时间"`
	UpdatedAt  time.Time `gorm:"autoUpdateTime;comment:更新时间"`
	DeletedAt  gorm.DeletedAt
}

func (Message) TableName() string {
	return "message"
}
